/**
 * 添加或者修改页面
 */
var SysGroupSettingInfoDlg = {
    data: {
        grade: "",
        earnings: "",
        createTime: ""
    }
};

layui.use(['form', 'admin', 'ax'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;

    form.verify({
        // 方式一
        // value：表单的值、item：表单的DOM对象
        operationCount: function(value, item){
            if(/^[+]{0,1}(\d+)$/) {
                return '填写数字必须为正整数！'
            }
        },

        // 方式二
        // 数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
        operationCount: [
            /^[+]{0,1}(\d+)$/,
            '填写数字必须为正整数！'
        ]
    });

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/sysGroupSetting/addItem", function (data) {
            if(data.code == 200){
                Feng.success("添加成功！");
            }else{
                Feng.error(data.message);
            }

            //传给上个页面，刷新table用
            admin.putTempData('formOk', true);

            //关掉对话框
            admin.closeThisDialog();

        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

});